<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>

    //sum > 2000   i
    var sum = 0;
    for (var i = 1; i < 101; i++ ){
        sum+=i; // 63
        // 判定 sum > 2000  true  结束循环    break  结束最近的一个循环
        if (sum>2000){
            break;
        }
    }
    console.log("i="+i)

</script>
</body>
</html>